<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVisitorReservesLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('visitor_reserves_log', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('visitor_reserves_id')->index()->comment('访客预约id');
            $table->bigInteger('visitor_id')->index()->comment('访客id');
            $table->bigInteger('interviewee_information_id')->index()->comment('受访者id');
            $table->string('reason')->default('')->comment('访问原因');
            $table->json('device_groups')->comment('通行方式');
            $table->integer('source')->default('0')->comment('访问区域');
            $table->time('start_time')->comment('开始时间');
            $table->time('end_time')->comment('结束时间');
            $table->string('interviewee_name')->default('')->comment('受访者名称');
            $table->string('interviewee_phone')->default('')->comment('受访者电话');
            $table->string('interviewee_openId')->default('')->comment('受访者openId');
            $table->string('visitor_name')->default('')->comment('访客名称');
            $table->string('visitor_telephone')->default('')->comment('访客电话');
            $table->string('visitor_openId')->default('')->comment('访客openId');
            $table->string('appId')->default('')->comment('appId');
            $table->integer('authorId')->comment('authorId');
            $table->string('captcha')->nullable()->comment('验证码');
            $table->integer('passType')->default('0')->nullable()->comment('通行证类型');
            $table->json('peers')->nullable()->comment('同行');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('visitor_reserves_log');
    }
}
